<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <div id="example">
    <h2>绑定监听</h2>
    <button @click='test1'>你好</button>
    <button @click='test2("world")'>hello</button>
    <button @click='test3("world", $event)'>hi</button>
    
    <h2>事件修饰符</h2>
    <!-- 阻止事件默认行为 停止事件冒泡 只响应一次 -->
    <a href="http://www.atguigu.com" @click.prevent="test4">点我点我</a>
    <div style="width:200px;height:200px;background-color:#666" @click="test5">
      <div style='width: 100px;height:100px;background-color:#ff0f' @click.stop='test6'></div>
    </div>
    <button @click.once="test7">只能点一次额</button>
    <h2>按键修饰符</h2>
     <input v-model='msg' type="text" @keyup.enter='test8'>
     <input type="text" v-modle='msg' @keyup.13='test8'>
  </div>
  <script src="../js/vue.js"></script>
  <script>
    new Vue({
      el:"#example",
      data:{
       msg:'okok!'
      },
      methods:{
       test1(event){
         alert(event.target.innerHTML)
       },
        test2(c){
          alert(c)
        },
        test3(content,event){
          alert(content)
          alert(event.target.innerHTML)
        },
        test4(){
          alert('别点了')
        },
        test5(){
          alert('外面响应了')
        },
        test6(){
          alert('里面响应了')
        },
        test7(){
          alert('点击了')
        },
        test8(){
          alert(this.msg)
        }
      }
    })
  </script>
</body>
</html>